Repository navigation
Conversation
save a string and compare tests against it with insta
include source text in header for clarity + remove trash
✅ Deploy Preview ready!
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Tree rendering is nondeterministic for map-bearing nodes, omits table captions, and one existing exporter path is removed from normal CI.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Migrates parser and exporter tests to deterministic insta snapshots and documents the new workflow.
Changes:
- Adds
Parser::render_tree()and parser snapshot utilities. - Replaces print-based and direct exporter assertions with snapshots.
- Adds snapshot configuration, fixtures, and contributor documentation.
| File | Description |
|---|---|
.cargo/config.toml |
Configures snapshot metadata formatting. |
.gitignore |
Ignores pending snapshots. |
README.org |
Documents snapshot workflows. |
crates/org-wasm/src/lib.rs |
Reorders parser imports. |
crates/org-parser/Cargo.toml |
Adds insta. |
crates/org-parser/src/lib.rs |
Registers rendering utilities and snapshots tests. |
crates/org-parser/src/render.rs |
Implements parser-tree rendering. |
crates/org-parser/src/test_util.rs |
Adds the snap! helper. |
crates/org-parser/src/types.rs |
Removes legacy tree printing. |
crates/org-parser/src/node_pool.rs |
Removes legacy tree printing. |
crates/org-parser/src/object/sup_sub.rs |
Snapshots superscript parsing. |
crates/org-parser/src/object/org_macro.rs |
Snapshots macro parsing. |
crates/org-parser/src/object/markup.rs |
Snapshots markup parsing. |
crates/org-parser/src/object/link.rs |
Snapshots link parsing. |
crates/org-parser/src/object/latex_frag.rs |
Snapshots LaTeX fragments. |
crates/org-parser/src/object/emoji.rs |
Snapshots invalid emoji parsing. |
crates/org-parser/src/element/table.rs |
Snapshots table parsing. |
crates/org-parser/src/element/plain_list.rs |
Snapshots list parsing. |
crates/org-parser/src/element/latex_env.rs |
Snapshots LaTeX environments. |
crates/org-parser/src/element/keyword.rs |
Removes stale debug code. |
crates/org-parser/src/element/heading.rs |
Snapshots heading parsing. |
crates/org-parser/src/element/drawer.rs |
Snapshots drawer parsing. |
crates/org-parser/src/element/block.rs |
Snapshots block parsing. |
crates/org-parser/snapshots/*.snap |
Adds 79 expected parser-tree snapshots. |
crates/org-exporter/Cargo.toml |
Adds insta. |
crates/org-exporter/src/utils.rs |
Snapshots table-of-contents output. |
crates/org-exporter/src/org.rs |
Converts Org exporter tests to snapshots. |
crates/org-exporter/src/html.rs |
Converts HTML exporter tests to snapshots. |
crates/org-exporter/src/include.rs |
Applies formatting-only changes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+22
to
+25
| Expr::RegularLink(l) => ids.extend(l.caption), | ||
| Expr::Affiliated(Affiliated::Name(id)) => ids.extend(id), | ||
| Expr::Affiliated(Affiliated::Caption(id)) => ids.push(*id), | ||
| Expr::Affiliated(Affiliated::Attr { child_id, .. }) => ids.extend(child_id), |
| "", | ||
| node.start, | ||
| node.end, | ||
| node.obj, |
| } | ||
|
|
||
| #[test] | ||
| #[ignore = "known bug: org exporter emits the src block body once per line (5x here)"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


this PR overhauls the testing system to use snapshots to verify the stability of the parser. before, a lot of these were just print statements and manually verified (i know...), so it's a pretty big improvement.
instadev dependencyParser::render_tree(): provides an indented view of the parser and includes spans. replacesprint_tree()snap!()macro: used inorg-parserfor writing tests that check against the parser treeorg-exportertests use inline snapshots instead of having to manually generate the output and inserting it manually (insta inserts text into empty snaps@"")also updated the README with testing docs since
instahas some slight understanding overhead, but it's fairly straightforward imo.